/*
 * Copyright (C) Cvitek Co., Ltd. 2019-2020. All rights reserved.
 *
 * File Name: include/comm_errno.h
 * Description:
 *   error code definition.
 */

#ifndef __ERRNO_H__
#define __ERRNO_H__


#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */


#ifndef ERR_APPID
#define ERR_APPID  (0x00000000L)
#endif

typedef enum _err_level_e {
	EN_ERR_LEVEL_DEBUG = 0,  /* debug-level                                  */
	EN_ERR_LEVEL_INFO,       /* informational                                */
	EN_ERR_LEVEL_NOTICE,     /* normal but significant condition             */
	EN_ERR_LEVEL_WARNING,    /* warning conditions                           */
	EN_ERR_LEVEL_ERROR,      /* error conditions                             */
	EN_ERR_LEVEL_CRIT,       /* critical conditions                          */
	EN_ERR_LEVEL_ALERT,      /* action must be taken immediately             */
	EN_ERR_LEVEL_FATAL,      /* just for compatibility with previous version */
	EN_ERR_LEVEL_BUTT
} err_level_e;


/******************************************************************************	*/
/*|----------------------------------------------------------------|*/
/*| 11|   APP_ID   |   MOD_ID    | ERR_LEVEL |   ERR_ID            |*/
/*|----------------------------------------------------------------|*/
/*|<--><--6bits----><----8bits---><--3bits---><------13bits------->|*/
/*******************************************************************************/

#define DEF_ERR(module, level, errid) \
	((int)(0xC0000000L | (ERR_APPID) | ((module) << 16) | ((level) << 13) | (errid)))

/* NOTE! the following defined all common error code,		*/
/*** all module must reserved 0~63 for their common error code*/

typedef enum _en_err_code_e {
	EN_ERR_INVALID_DEVID = 1, /* invalid device ID */
	EN_ERR_INVALID_CHNID = 2, /* invalid channel ID*/
	EN_ERR_ILLEGAL_PARAM = 3,
	/* at least one parameter is illegal*/
	/* eg, an illegal enumeration value */
	EN_ERR_EXIST         = 4, /* resource exists*/
	EN_ERR_UNEXIST       = 5, /* resource unexists */
	EN_ERR_NULL_PTR      = 6, /* using a NULL point*/
	EN_ERR_NOT_CONFIG    = 7,
	/* try to enable or initialize system, device*/
	/* or channel, before configing attribute*/
	EN_ERR_NOT_SUPPORT   = 8,
	/* operation or type is not supported by NOW*/
	EN_ERR_NOT_PERM      = 9,
	/* operation is not permitted*/
	/* eg, try to change static attribute*/
	EN_ERR_INVALID_PIPEID = 10,
	/* invalid pipe ID*/
	EN_ERR_INVALID_GRPID  = 11,
	/* invalid group ID*/
	EN_ERR_NOMEM         = 12,
	/* failure caused by malloc memory*/
	EN_ERR_NOBUF         = 13,
	/* failure caused by malloc buffer*/
	EN_ERR_BUF_EMPTY     = 14,
	/* no data in buffer */
	EN_ERR_BUF_FULL      = 15,
	/* no buffer for new data*/
	EN_ERR_SYS_NOTREADY  = 16,
	/* System is not ready, maybe not initialized or*/
	/* loaded. Returning the error code when opening*/
	/* a device file failed.*/
	EN_ERR_BADADDR       = 17,
	/* bad address,*/
	/* eg. used for copy_from_user & copy_to_user*/
	EN_ERR_BUSY          = 18,
	/* resource is busy,*/
	/* eg. destroy a venc chn without unregister it */
	EN_ERR_SIZE_NOT_ENOUGH = 19,
	/* buffer size is smaller than the actual size required */
	EN_ERR_INVALID_VB    = 20,
	/* invalid VB handle */
	EN_ERR_BUTT          = 63,
	/* maximum code, private error code of all modules*/
	/* must be greater than it */
} en_err_code_e;

typedef enum _en_vi_err_code_e {
	ERR_VI_FAILED_NOT_ENABLED = 64, /* device or channel not enable*/
	ERR_VI_FAILED_NOT_DISABLED, /* device not disable*/
	ERR_VI_FAILED_CHN_NOT_DISABLED, /* channel not disable*/
	ERR_VI_CFG_TIMEOUT, /* config timeout*/
	ERR_VI_NORM_UNMATCH, /* video norm of ADC and VIU is unmatch*/
	ERR_VI_INVALID_PHYCHNID, /* invalid phychn id*/
	ERR_VI_FAILED_NOTBIND, /* device or channel not bind */
	ERR_VI_FAILED_BINDED, /* device or channel not unbind */
	ERR_VI_DIS_PROCESS_FAIL /* dis process failed */
} en_vi_err_code_e;

typedef enum _en_vou_err_code_e {
	EN_ERR_VO_DEV_NOT_CONFIG = 0x40,
	EN_ERR_VO_DEV_NOT_ENABLED = 0x41,
	EN_ERR_VO_DEV_HAS_ENABLED = 0x42,
	EN_ERR_VO_DEV_HAS_BINDED = 0x43,
	EN_ERR_VO_DEV_NOT_BINDED = 0x44,

	EN_ERR_VO_LAYER_NOT_ENABLED = 0x45,
	EN_ERR_VO_LAYER_NOT_DISABLED = 0x46,
	EN_ERR_VO_LAYER_NOT_CONFIG = 0x47,

	EN_ERR_VO_CHN_NOT_DISABLED = 0x48,
	EN_ERR_VO_CHN_NOT_ENABLED = 0x49,
	EN_ERR_VO_CHN_NOT_CONFIG = 0x4a,

	EN_ERR_VO_WAIT_TIMEOUT = 0x4e,
	EN_ERR_VO_INVALID_VFRAME = 0x4f,
	EN_ERR_VO_INVALID_RECT_PARA = 0x50,

	EN_ERR_VO_CHN_AREA_OVERLAP = 0x65,

	EN_ERR_VO_INVALID_LAYERID = 0x6D,
	EN_ERR_VO_VIDEO_HAS_BINDED = 0x6E,
	EN_ERR_VO_VIDEO_NOT_BINDED = 0x6F,

	EN_ERR_VO_INVALID_WBCID = 0x70,
	EN_ERR_VO_WBC_NOT_ENABLED = 0x71,
	EN_ERR_VO_WBC_NOT_DISABLED = 0x72,
	EN_ERR_VO_WBC_SRC_NOT_CONFIG = 0x73,
	EN_ERR_VO_WBC_ATTR_NOT_CONFIG = 0x74,
	/* new added */
	ERR_VO_BUTT
} en_vou_err_code_e;

#define ERR_SYS_NULL_PTR         DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_SYS_NOTREADY         DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_SYS_NOT_PERM         DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_SYS_NOMEM            DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_SYS_ILLEGAL_PARAM    DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_SYS_BUSY             DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_SYS_NOT_SUPPORT      DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_SYS_REMAPPING        DEF_ERR(ID_SYS, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)

#define ERR_VB_NULL_PTR DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_VB_INVALID DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_VB)
#define ERR_VB_NOMEM DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_VB_NOBUF DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
#define ERR_VB_UNEXIST DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
#define ERR_VB_ILLEGAL_PARAM DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_VB_NOTREADY DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_VB_BUSY DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_VB_NOT_PERM DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_VB_SIZE_NOT_ENOUGH DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_SIZE_NOT_ENOUGH)
#define ERR_VB_2MPOOLS DEF_ERR(ID_VB, EN_ERR_LEVEL_ERROR, EN_ERR_BUTT + 1)

#define ERR_VI_INVALID_PARA DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_VI_INVALID_DEVID DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
#define ERR_VI_INVALID_PIPEID DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_PIPEID)
#define ERR_VI_INVALID_CHNID DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
#define ERR_VI_INVALID_NULL_PTR DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_VI_FAILED_NOTCONFIG DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
#define ERR_VI_SYS_NOTREADY DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_VI_BUF_EMPTY DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
#define ERR_VI_BUF_FULL DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
#define ERR_VI_NOMEM DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_VI_NOT_SUPPORT DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_VI_BUSY DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_VI_NOT_PERM DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_VI_FAILED_NOT_ENABLED DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_FAILED_NOT_ENABLED)
#define ERR_VI_FAILED_NOT_DISABLED DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_FAILED_NOT_DISABLED)
#define ERR_VI_FAILED_CHN_NOT_DISABLED DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_FAILED_CHN_NOT_DISABLED)
#define ERR_VI_CFG_TIMEOUT DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_CFG_TIMEOUT)
#define ERR_VI_NORM_UNMATCH DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_NORM_UNMATCH)
#define ERR_VI_INVALID_PHYCHNID DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_INVALID_PHYCHNID)
#define ERR_VI_FAILED_NOTBIND DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_FAILED_NOTBIND)
#define ERR_VI_FAILED_BINDED DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, ERR_VI_FAILED_BINDED)
#define ERR_VI_PIPE_EXIST DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
#define ERR_VI_PIPE_UNEXIST DEF_ERR(ID_VI, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)

#define ERR_VPSS_NULL_PTR DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_VPSS_NOTREADY DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_VPSS_INVALID_DEVID DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
#define ERR_VPSS_INVALID_CHNID DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
#define ERR_VPSS_EXIST DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
#define ERR_VPSS_UNEXIST DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
#define ERR_VPSS_NOT_SUPPORT DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_VPSS_NOT_PERM DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_VPSS_NOMEM DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_VPSS_NOBUF DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
#define ERR_VPSS_ILLEGAL_PARAM DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_VPSS_BUSY DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_VPSS_BUF_EMPTY DEF_ERR(ID_VPSS, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)

/* System define error code */
#define ERR_VO_BUSY DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_VO_NO_MEM DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_VO_NULL_PTR DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_VO_SYS_NOTREADY DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_VO_INVALID_DEVID DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
#define ERR_VO_INVALID_CHNID DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
#define ERR_VO_ILLEGAL_PARAM DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_VO_NOT_SUPPORT DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_VO_NOT_PERMIT DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_VO_INVALID_LAYERID DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_INVALID_LAYERID)
#define ERR_VO_INVALID_WBCID DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_INVALID_WBCID)
/* Device relative error code */
#define ERR_VO_DEV_NOT_CONFIG DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_DEV_NOT_CONFIG)
#define ERR_VO_DEV_NOT_ENABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_DEV_NOT_ENABLED)
#define ERR_VO_DEV_HAS_ENABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_DEV_HAS_ENABLED)
#define ERR_VO_DEV_HAS_BINDED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_DEV_HAS_BINDED)
#define ERR_VO_DEV_NOT_BINDED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_DEV_NOT_BINDED)
/* Video layer relative error code */
#define ERR_VO_VIDEO_NOT_ENABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_LAYER_NOT_ENABLED)
#define ERR_VO_VIDEO_NOT_DISABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_LAYER_NOT_DISABLED)
#define ERR_VO_VIDEO_NOT_CONFIG DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_LAYER_NOT_CONFIG)
#define ERR_VO_VIDEO_HAS_BINDED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_VIDEO_HAS_BINDED)
#define ERR_VO_VIDEO_NOT_BINDED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_VIDEO_NOT_BINDED)
/* Channel Relative error code */
#define ERR_VO_CHN_NOT_DISABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_CHN_NOT_DISABLED)
#define ERR_VO_CHN_NOT_ENABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_CHN_NOT_ENABLED)
#define ERR_VO_CHN_NOT_CONFIG DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_CHN_NOT_CONFIG)
#define ERR_VO_CHN_AREA_OVERLAP DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_CHN_AREA_OVERLAP)
/* Wbc Relative error code */
#define ERR_VO_WBC_NOT_ENABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_WBC_NOT_ENABLED)
#define ERR_VO_WBC_NOT_DISABLED DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_WBC_NOT_DISABLED)
#define ERR_VO_WBC_SRC_NOT_CONFIG DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_WBC_SRC_NOT_CONFIG)
#define ERR_VO_WBC_ATTR_NOT_CONFIG DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_WBC_ATTR_NOT_CONFIG)

/* MISCellaneous error code*/
#define ERR_VO_WAIT_TIMEOUT DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_WAIT_TIMEOUT)
#define ERR_VO_INVALID_VFRAME DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_INVALID_VFRAME)
#define ERR_VO_INVALID_RECT_PARA DEF_ERR(ID_VO, EN_ERR_LEVEL_ERROR, EN_ERR_VO_INVALID_RECT_PARA)

/* failure caused by malloc buffer */
#define ERR_GDC_NOBUF DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
#define ERR_GDC_NOMEM DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_GDC_BUF_EMPTY DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
#define ERR_GDC_NULL_PTR DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_GDC_ILLEGAL_PARAM DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_GDC_BUF_FULL DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
#define ERR_GDC_SYS_NOTREADY DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_GDC_NOT_SUPPORT DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_GDC_NOT_PERMITTED DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_GDC_BUSY DEF_ERR(ID_GDC, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)

/* Dpu define error code */
#define ERR_DPU_INVALID_DEVID DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
#define ERR_DPU_INVALID_CHNID DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
#define ERR_DPU_ILLEGAL_PARAM DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_DPU_EXIST DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
#define ERR_DPU_UNEXIST DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
#define ERR_DPU_NULL_PTR DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_DPU_NOT_CONFIG DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
#define ERR_DPU_NOT_SUPPORT DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_DPU_NOT_PERM DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_DPU_NOMEM DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_DPU_NOBUF DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
#define ERR_DPU_BUF_EMPTY DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
#define ERR_DPU_BUF_FULL DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
#define ERR_DPU_NOTREADY DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_DPU_ERR_BADADDR DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR )
#define ERR_DPU_BUSY DEF_ERR(ID_DPU, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)

/* System is not ready,maybe not initialized or loaded.
 * Returning the error code when opening a device file failed.
 */
#define ERR_RGN_SYS_NOTREADY DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
/* invalid device ID */
#define ERR_RGN_INVALID_DEVID DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
/* invalid channel ID */
#define ERR_RGN_INVALID_CHNID DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID)
/* at least one parameter is illegal ,eg, an illegal enumeration value	*/
#define ERR_RGN_ILLEGAL_PARAM DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
/* channel exists */
#define ERR_RGN_EXIST DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
/* region unexist */
#define ERR_RGN_UNEXIST DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
/* using a NULL point */
#define ERR_RGN_NULL_PTR DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
/* try to enable or initialize system, device or channel, before config attribute */
#define ERR_RGN_NOT_CONFIG DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG)
/* operation is not supported by NOW */
#define ERR_RGN_NOT_SUPPORT DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
/* operation is not permitted ,eg, try to change static attribute */
#define ERR_RGN_NOT_PERM DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
/* failure caused by malloc memory */
#define ERR_RGN_NOMEM DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
/* failure caused by malloc buffer */
#define ERR_RGN_NOBUF DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
/* no data in buffer */
#define ERR_RGN_BUF_EMPTY DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)
/* no buffer for new data */
#define ERR_RGN_BUF_FULL DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL)
/* bad address, eg. used for copy_from_user & copy_to_user */
#define ERR_RGN_BADADDR DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BADADDR)
/* resource is busy, eg. destroy a venc chn without unregistering it */
#define ERR_RGN_BUSY DEF_ERR(ID_RGN, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)

/* Stitch define error code */
#define ERR_STITCH_NULL_PTR DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR)
#define ERR_STITCH_NOTREADY DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY)
#define ERR_STITCH_INVALID_SRCID DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID)
#define ERR_STITCH_EXIST DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST)
#define ERR_STITCH_UNEXIST DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST)
#define ERR_STITCH_NOT_SUPPORT DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT)
#define ERR_STITCH_NOT_PERM DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM)
#define ERR_STITCH_NOMEM DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM)
#define ERR_STITCH_NOBUF DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF)
#define ERR_STITCH_ILLEGAL_PARAM DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM)
#define ERR_STITCH_BUSY DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_BUSY)
#define ERR_STITCH_BUF_EMPTY DEF_ERR(ID_STITCH, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY)

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif  /* __ERRNO_H__ */

